//
//  AIFDeleteAccountManager.m
//  PywSdk
//
//  Created by smallwave on 16/8/29.
//  Copyright © 2016年 zero. All rights reserved.
//

#import "AIFDeleteAccountManager.h"

@implementation AIFDeleteAccountManager

NSString *const DeleteAccount_Sign = @"sign";
NSString *const DeleteAccount_GameId = @"gameid";
NSString *const DeleteAccount_Tid = @"tid";
NSString *const DeleteAccount_Passport = @"passport";
NSString *const DeleteAccount_PassportToken = @"passport_token";
NSString *const DeleteAccount_Account = @"account";

- (instancetype)init{
    self = [super init];
    if (self) {
        self.child = self;
        self.paramSource = self;
        self.validate = self;
    }
    return self;
}

#pragma mark - ETAPIManager
- (NSString *)methodName{
    return URL_DELETEACCOUNT;
}
- (ETAPIManagerRequestType)requestType{
    return ETAPIManagerRequestTypePost;
}
- (NSString *)seriviceType{
    return [PywAppInfo sharedAppInfo].seriviceType;
}

#pragma mark - ETAPIManagerParamSourceDelegate
- (NSDictionary *)paramsForApi:(ETApiBaseManager *)manager{
    
    NSString *account = self.account;
    NSString *passport = [PywPlatformMain sharedPlatformMain].passport;
    NSString *passport_token = [PywPlatformMain sharedPlatformMain].passport_Token;
    NSString *gameid = [PywAppInfo sharedAppInfo].gameId;
    
    NSString *tid = [PywAppInfo sharedAppInfo].tid;
    NSString *apiSecret2 = [AppUtil getApiSecret2:tid apiSecret:[PywAppInfo sharedAppInfo].apisecret];
    NSString *sign = [NSString stringWithFormat:@"%@%@%@", passport, account, apiSecret2];
    sign = [PywCipherUtils md5:sign];
    
    MutableDictionary *param = [[MutableDictionary alloc] init];
    [param setObject:account forKey:DeleteAccount_Account];
    [param setObject:passport forKey:DeleteAccount_Passport];
    [param setObject:passport_token forKey:DeleteAccount_PassportToken];
    [param setObject:gameid forKey:DeleteAccount_GameId];
    [param setObject:tid forKey:DeleteAccount_Tid];
    [param setObject:sign forKey:DeleteAccount_Sign];
    return param;
}

#pragma mark - ETAPIManagerValidator
- (BOOL)manager:(ETApiBaseManager *)manager isCorrectWithParamsData:(NSDictionary *)data{
    return YES;
}

- (BOOL)manager:(ETApiBaseManager *)manager isCorrectWithCallBackData:(NSDictionary *)data{
    return YES;
}

@end
